﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>信息管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <script src="../../../layuiadmin/lib/jquery.min.js"></script>
    <script src="../../../layuiadmin/lib/api.js"></script>
    <script src="../../../layuiadmin/artdialog/artDialog.js?skins=chrome"></script>
    <script src="../../../layuiadmin/lib/common.js"></script>
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/lib/system.js"></script>
    <script>
        //检查服务器是否已登录，没有登录则跳转至登录页。
        sys_islogin();
    </script>
</head>
<body>

    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">

                    <div class="layui-inline">
                        <label class="layui-form-label">信息内容</label>
                        <div class="layui-input-inline">
                            <input type="text" name="title" placeholder="请输入" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">选择日期</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="startTime" id="startTime" placeholder="开始日期">
                        </div>
                        <div class="layui-form-mid">
                            -
                        </div>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="endTime" id="endTime" placeholder="结束日期">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                        </button>
                    </div>
                </div>
            </div>

            <div class="layui-card-body">
                
                <table id="notice-list" lay-filter="notice-list"></table>
            </div>
        </div>
    </div>

    
    <script>
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'contlist', 'table', 'laydate'], function () {
            var table = layui.table, form = layui.form;


            //监听搜索
            form.on('submit(LAY-app-contlist-search)', function (data) {
                var field = data.field;
                console.log(data.field);
                //执行重载
                table.reload('notice-list', {
                    where: field
                });
            });


            //表格管理
            table.render({
                elem: '#notice-list'
                , url: '/NoticeMerber/NoticeList' //接口
                , cols: [[
                    { type: 'checkbox', fixed: 'left', field: 'ID' }
                    , { field: 'DETAIL', title: '内容', align: 'center' }
                    , { field: 'CREATENAME', title: '发送人', align: 'center',width:150 }
                    , { field: 'CREATETIME', title: '时间', align: 'center',width:200 }                    
                ]]
                , page: true
                , limit: 20
                , where: {

                }
                , limits: [10, 15, 20, 25, 30]
                , text: {
                    none: '暂无相关数据'
                }
            });

            $('.layui-btn.layuiadmin-btn-list').on('click', function () {
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });


            var laydate = layui.laydate;
            //开始日期
            var insStart = laydate.render({
                elem: '#startTime'
                //, min: 0
                //, type: 'datetime'
                , done: function (value, date) {
                    //更新结束日期的最小日期
                    insEnd.config.min = lay.extend({}, date, {
                        month: date.month - 1
                    });

                    //自动弹出结束日期的选择器
                    insEnd.config.elem[0].focus();
                }
            });

            //结束日期
            var insEnd = laydate.render({
                elem: '#endTime'
                //, min: 0
                //, type: 'datetime'
                , done: function (value, date) {
                    //更新开始日期的最大日期
                    insStart.config.max = lay.extend({}, date, {
                        month: date.month - 1
                    });
                }
            });

        });

        $.ajax({
            url: "/NoticeMerber/SetReader",    //请求的url地址
            dataType: "json",   //返回格式为json特性
            type: "POST",   //请求方式           
            success: function (data) {
               
            },

            error: function (res) {
                console.log(res);
            }
        });
    </script>
</body>
</html>
